load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "tracing",
    srcs = [
        "context.go",
        "crdbspan.go",
        "doc.go",
        "span.go",
        "span_finalizer_race_off.go",
        "span_finalizer_race_on.go",
        "span_inner.go",
        "span_options.go",
        "tags.go",
        "test_utils.go",
        "tracer.go",
        "tracer_snapshots.go",
        "utils.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/util/tracing",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/settings",
        "//pkg/util/allstacks",
        "//pkg/util/buildutil",
        "//pkg/util/envutil",
        "//pkg/util/iterutil",
        "//pkg/util/metamorphic",
        "//pkg/util/netutil/addr",
        "//pkg/util/protoutil",
        "//pkg/util/randutil",
        "//pkg/util/ring",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing/tracingpb",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_logtags//:logtags",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_gogo_protobuf//jsonpb",
        "@com_github_gogo_protobuf//types",
        "@com_github_petermattis_goid//:goid",
        "@com_github_pmezard_go_difflib//difflib",
        "@io_opentelemetry_go_otel//attribute",
        "@io_opentelemetry_go_otel//codes",
        "@io_opentelemetry_go_otel//semconv/v1.4.0:v1_4_0",
        "@io_opentelemetry_go_otel_exporters_otlp_otlptrace_otlptracegrpc//:otlptracegrpc",
        "@io_opentelemetry_go_otel_exporters_zipkin//:zipkin",
        "@io_opentelemetry_go_otel_sdk//resource",
        "@io_opentelemetry_go_otel_sdk//trace",
        "@io_opentelemetry_go_otel_trace//:trace",
        "@org_golang_google_grpc//metadata",
        "@org_golang_x_net//trace",
    ],
)

go_test(
    name = "tracing_test",
    size = "small",
    srcs = [
        "bench_test.go",
        "main_test.go",
        "span_test.go",
        "tags_test.go",
        "tracer_external_test.go",
        "tracer_test.go",
    ],
    embed = [":tracing"],
    deps = [
        "//pkg/base",
        "//pkg/ccl",
        "//pkg/kv/kvbase",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/settings",
        "//pkg/sql",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/util/iterutil",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/randutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing/grpcinterceptor",
        "//pkg/util/tracing/tracingpb",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_logtags//:logtags",
        "@com_github_gogo_protobuf//types",
        "@com_github_stretchr_testify//require",
        "@io_opentelemetry_go_otel//attribute",
        "@io_opentelemetry_go_otel_sdk//trace",
        "@io_opentelemetry_go_otel_sdk//trace/tracetest",
        "@io_opentelemetry_go_otel_trace//:trace",
        "@org_golang_google_grpc//metadata",
        "@org_golang_x_net//trace",
        "@org_golang_x_sync//errgroup",
    ],
)
